//
//  FRQSupportViewController.m
//  FRQBluetoothKit_Example
//
//  Created by admin on 2023/10/24.
//  Copyright © 2023 xuchunhai. All rights reserved.
//

#import "FRQSupportViewController.h"
#import "SupportTableViewCell.h"
#import "FRQQuestionDesViewController.h"
@interface FRQSupportViewController ()
@property (nonatomic,strong) NSArray *arrTitle;
@end

@implementation FRQSupportViewController
-(void)addTableView{
    [self.view addSubview:self.tableView];
    
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_topLayoutGuideBottom);
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(self.mas_bottomLayoutGuideTop);
    }];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"Support";
    [self.view addSubview:self.tableView];
    [self.tableView reloadData];
    self.tableView.backgroundColor=skUIColorFromRGB(0x1c1f2a);
    // Do any additional setup after loading the view.
    self.arrTitle=@[@{@"title":@"I cannot display images on my device, what can I do? ",@"message":@"Ensure that your device is powered and turned on. Additionally, consider the possibility that the delay between connecting to Bluetooth and transmitting the image to the device may be a factor. This is because, in order to optimize battery life, Bluetooth automatically disconnects after a 10-minute interval."},@{@"title":@"Why are GIF images not accepted? ",@"message":@"The AMOLED screen of our current version Tokenshow is designed for still images. However, in the next version we will introduce this capability, allowing you to enjoy your favorite GIFs."},@{@"title":@"Can I access another Reseller’s gallery? ",@"message":@"No, each Reseller’s gallery is only available for its own users."},@{@"title":@"Can I use 2 phones with the same device?",@"message":@"Yes, your device is linked to your account, so you can seamlessly switch between phones without any issues. "},@{@"title":@"What’s the battery life and how long does it take to be fully recharged?",@"message":@"A fully-charged device has a battery life of 8 - 10 hours. Battery life and charge cycles vary with use and other factors. The device takes approximately 2 hours to fully charge and will automatically cease charging once full capacity is reached."},@{@"title":@"Can I charge my device with other chargers in the market?",@"message":@"We recommend using the charger provided with your device to ensure optimal performance and safety. Our charger is specifically designed to work with your device's power requirements and charging protocols, ensuring a consistent and efficient charging experience."},@{@"title":@"Where can I find the activation code? ",@"message":@"The activation QR code is located on the front of the manual card inside the device box. In the event that the manual card is missing, feel free to contact our support team for further assistance."},@{@"title":@"Why did I not receive the verification code?",@"message":@"Our activation code is sent automatically to the email address you used when registering your account. Please ensure your registration email is valid and check your spam folder if you cannot find the code. If you still need assistance, feel free to contact us."},@{@"title":@"How do I pair my device?",@"message":@"Once you've launched the Tokenshow app and reached the Welcome page, click on the 'Pair Device' button. Make sure bluetooth is enabled on your phone, and hold your phone close to the device during the pairing process. The app will then scan for your Tokenshow device. Once your device appears on the list, click on “Pair”. Upon successful pairing, your device will be connected and ready for use."},@{@"title":@"Is my Wallet secured when I verify it with Tokenshow?",@"message":@"Yes, Tokenshow utilizes the robust Rainbow Protocol for this purpose. The connection is necessary only once and is exclusively for authentication, after which it will automatically disconnect."}];
    
    [self SetupRightZLingItem:@"help_ico_pop" isZLingImage:YES];
    
    
}
- (void)BtnRightZLingAction:(UIButton *)sender{
    FRQContactUsViewController *view=[[FRQContactUsViewController alloc] init];
    [self.navigationController pushViewController:view animated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark - 代理方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arrTitle.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 55;
}
//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
//    return 12;
//}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 50;
}


- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    
    static NSString *cellIdentifier = @"SupportTableViewCell";
    SupportTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = skXibView(@"SupportTableViewCell");
    }
//    NSString *name=[NSString stringWithFormat:@"Question %ld",indexPath.row+1];
    NSDictionary *dic=[self.arrTitle objectAtIndex:indexPath.row];
    
    NSString *title=[dic objectForKey:@"title"];
    NSString *temp = [title stringByReplacingOccurrencesOfString:@"\r" withString:@""];
    
    temp = [temp stringByReplacingOccurrencesOfString:@"\n" withString:@""];
    cell.labTitle.text=temp;
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    FRQQuestionDesViewController *view=[[FRQQuestionDesViewController alloc] init];
    NSDictionary *dic=[self.arrTitle objectAtIndex:indexPath.row];
    
    NSString *title=[dic objectForKey:@"title"];
    NSString *message=[dic objectForKey:@"message"];
    view.titleStr=title;
    view.message=message;
    view.modalPresentationStyle=0;
    
    [self.navigationController pushViewController:view animated:YES];
}
@end
